﻿using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using System.Collections;

namespace CSharp.Libs.Net
{
    public class KocPostSubmitter : PostSubmitter
    {
        #region declarations
        private ArrayList _aryPostCollector = new ArrayList();
        #endregion
        


        #region constructor / finalizer
        /// <summary>
        /// Default constructor.
        /// </summary>
        public KocPostSubmitter()
        {
        }

        /// <summary>
        /// Constructor that accepts a url as a parameter
        /// </summary>
        /// <param name="url">The url where the post will be submitted to.</param>
        public KocPostSubmitter(string url)
            : this()
        {
            base.Url = url;
        }

        /// <summary>
        /// Constructor allowing the setting of the url and items to post.
        /// </summary>
        /// <param name="url">the url for the post.</param>
        /// <param name="values">The values for the post.</param>
        public KocPostSubmitter(string url, NameValueCollection values)
            : this(url)
        {
            base.PostItems = values;
        }
        #endregion
        
        
        
        #region event handling
        #endregion
        
        
        
        #region private functions
        private void _AddPost()
        {
            KocPostSubmitterItem KPSI = new KocPostSubmitterItem();
            KPSI.Url = this.Url;
            KPSI.Params = this.PostItems;
            KPSI.PostCount = 0; //Predefined in Class, but for better readabilty set here 
            KPSI.Result = "";   //Predefined in Class, but for better readabilty set here 

            _aryPostCollector.Add(KPSI);
        }
        #endregion
        
        
        
        #region interface
        #region properties
        #endregion

        #region methods
        /// <summary>
        /// Posts the supplied data to specified url.
        /// </summary>
        /// <returns>a string containing the result of the post.</returns>
        //public string Post()
        //{
        //    return base.Post();
        //}
        /// <summary>
        /// Posts the supplied data to specified url.
        /// </summary>
        /// <param name="url">The url to post to.</param>
        /// <returns>a string containing the result of the post.</returns>
        //public string Post(string url)
        //{
        //    base.Url = url;
        //    return this.Post();
        //}
        /// <summary>
        /// Posts the supplied data to specified url.
        /// </summary>
        /// <param name="url">The url to post to.</param>
        /// <param name="values">The values to post.</param>
        /// <returns>a string containing the result of the post.</returns>
        //public string Post(string url, NameValueCollection values)
        //{
        //    base.PostItems = values;
        //    return base.Post(url);
        //}
        #endregion
        #endregion
    }
}
